package com.summer.peony.system.pojo;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @ClassName: SysUser
 * @Description: TODO(用户实体类)
 * @author: TaoGe
 * @date: 2020年6月10日 下午4:39:58
 * @version: v0.0.1
 */
public class SysUser implements Serializable {

	/**
	 * @author: TaoGe
	 * @Fields: serialVersionUID:TODO(用一句话描述这个变量表示什么)
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * @author: TaoGe
	 * @Fields: userId:TODO(用户id)
	 */
	private Integer userId;

	/**
	 * @author: TaoGe
	 * @Fields: username:TODO(用户名称)
	 */
	private String username;

	/**
	 * @author: TaoGe
	 * @Fields: password:TODO(用户密码)
	 */
	private String password;

	/**
	 * @author: TaoGe
	 * @Fields: salt:TODO(随机盐)
	 */
	private String salt;

	/**
	 * @author: TaoGe
	 * @Fields: phone:TODO(手机号码)
	 */
	private String phone;

	/**
	 * @author: TaoGe
	 * @Fields: avatar:TODO(头像)
	 */
	private String avatar;

	/**
	 * @author: TaoGe
	 * @Fields: deptId:TODO(部门id)
	 */
	private Integer deptId;

	/**
	 * @author: TaoGe
	 * @Fields: createTime:TODO(创建时间)
	 */
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date createTime;

	/**
	 * @author: TaoGe
	 * @Fields: updateTime:TODO(修改时间)
	 */
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date updateTime;

	/**
	 * @author: TaoGe
	 * @Fields: delFlag:TODO(0-正常，1-删除)
	 */
	private String delFlag;

	/**
	 * @author: TaoGe
	 * @Fields: lockFlag:TODO(0-正常，1-删除)
	 */
	private String lockFlag;

	/**
	 * @author: TaoGe
	 * @Fields: roleIds:TODO(角色组)
	 */
	private Integer[] roleIds;

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username == null ? null : username.trim();
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password == null ? null : password.trim();
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt == null ? null : salt.trim();
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone == null ? null : phone.trim();
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar == null ? null : avatar.trim();
	}

	public Integer getDeptId() {
		return deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag == null ? null : delFlag.trim();
	}

	public String getLockFlag() {
		return lockFlag;
	}

	public void setLockFlag(String lockFlag) {
		this.lockFlag = lockFlag == null ? null : lockFlag.trim();
	}

	public boolean isAdmin() {
		return isAdmin(this.userId);
	}

	public static boolean isAdmin(Integer userId) {
		return userId != null && 1 == userId;
	}

	@Override
	public String toString() {
		return "SysUser [userId=" + userId + ", username=" + username + ", password=" + password + ", salt=" + salt
				+ ", phone=" + phone + ", avatar=" + avatar + ", deptId=" + deptId + ", createTime=" + createTime
				+ ", updateTime=" + updateTime + ", delFlag=" + delFlag + ", lockFlag=" + lockFlag + "]";
	}

	public Integer[] getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(Integer[] roleIds) {
		this.roleIds = roleIds;
	}

}